package www.dianbaozu.com.ui

import android.view.View
import com.netease.nim.uikit.api.NIMHelper
import com.netease.nim.uikit.api.SessionHelper
import com.netease.nimlib.sdk.friend.constant.VerifyType
import www.dianbaozu.com.R
import www.dianbaozu.com.databinding.FragmentImTestBinding
import www.wen.com.common.lib.base.fragment.BaseVMFragment

class IMTestFragment : BaseVMFragment<FragmentImTestBinding>(), View.OnClickListener {
//    private val account1 = "vyjkaxjkfz6vybbo"
//    private val account2 = "4yqeqpfpxfg8n4oy"
    private val account1 = "t65304815"
    private val account2 = "t61429112"
    private var currentAccount = ""

//        accid:vyjkaxjkfz6vybbo,token:e638c6fa5468f3a9f6f380fcf0859309,tid:3894329639
//        accid:4yqeqpfpxfg8n4oy,token:73142c34c072ce2d139a87de090f3881,tid:3886689922

    override fun lazyInitView() {
        dataBinding.listener = this
    }

    override fun getLayoutId(): Int = R.layout.fragment_im_test

    override fun onClick(v: View) {
        when (v.id) {
            R.id.button -> {
//                SessionHelper.startTeamSession(requireContext(), "3886689922")
            }
            R.id.button2 -> {
//                SessionHelper.startP2PSession(
//                    requireContext(),
//                    if (currentAccount == account1)
//                        account2 else account1,
//                )
            }
            R.id.button3 -> {
                NIMHelper.login(account1, "0eca472b-8366-4350-9f4a-d9b201118cdc")
                currentAccount = account1
            }
            R.id.button4 -> {
                NIMHelper.login(account2, "576c40f5-c813-421a-abb8-7a3b74486822")
                currentAccount = account2
            }
            R.id.button5 -> {
                NIMHelper.addFriend(account1)
            }
            R.id.button6 -> {
                NIMHelper.addFriend(account2)
            }
        }
    }
}